package com.ajz.config.jwt;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * 
 * <p>用于生成一个过滤器类，对/api 链接下的所有资源访问进行JWT的验证 </p>
 *
 * @author xyj
 * @date 2018年11月2日
 */
@Configuration
public class jwtConfig {
	@Bean
	public FilterRegistrationBean jwtFilter() {
		final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
		registrationBean.setFilter(new JwtFilter());
		registrationBean.addUrlPatterns("/api/*");
		return registrationBean;
	}
}
